package com.sec.android.app.myfiles.module.search;

import android.app.LoaderManager;
import android.content.Context;

import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.module.abstraction.FileRecord.StorageType;
import com.sec.android.app.myfiles.navigation.NavigationInfo;

public class SearchAdapterBuilder {
    public static SearchAdapter createAdapter(FileRecord preRecord, Context context, NavigationInfo navigationInfo, LoaderManager loaderManager) {
        SearchAdapter adapter;
        StorageType storageType = preRecord.getStorageType();

        switch (storageType) {
            case Recent:
                adapter = new RecentSearchAdapter(context, navigationInfo, loaderManager);
                break;
            case Category:
                adapter = new CategorySearchAdapter(context, navigationInfo, loaderManager);
                break;
            case Downloads:
                adapter = new DownloadSearchAdapter(context, navigationInfo, loaderManager);
                break;
            default:
                adapter = new SearchAdapter(context, navigationInfo, loaderManager);
                break;
        }

        return adapter;
    }
}
